//
//  MineHeaderTableViewCell.m
//  community
//
//  Created by 小崔 on 2020/6/3.
//  Copyright © 2020 小崔. All rights reserved.
//

#import "MineHeaderTableViewCell.h"

@implementation MineHeaderTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatUI];
    }
    return self;
    
}

-(void)creatUI{
    [self addSubview:self.bgImage];
    [self.bgImage addSubview:self.headeImage];
    [self.bgImage addSubview:self.loginBtn];
    WEAKSELF
    [self.bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.mas_top).offset(iPhoneXStyle ? -44 : -20);
        make.left.equalTo(weakSelf.mas_left);
        make.right.equalTo(weakSelf.mas_right);
        make.height.equalTo(@200);
    }];
    [self.headeImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.bgImage.mas_centerY).offset(20);
        make.left.equalTo(weakSelf.mas_left).offset(20);
        make.width.equalTo(@50);
        make.height.equalTo(@50);
    }];
    [self.loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.bgImage.mas_centerY).offset(20);
        make.left.equalTo(weakSelf.headeImage.mas_right).offset(10);
        make.height.equalTo(@40);
    }];
    
}






- (UIImageView *)bgImage {
    if (!_bgImage) {
        self.bgImage = [[UIImageView alloc]init];
        _bgImage.image = [UIImage imageNamed:@"Bar1"];
    }
    return _bgImage;
}
- (UIImageView *)headeImage{
    if (!_headeImage) {
        self.headeImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"header"]];
    }
    return _headeImage;
}
- (UIButton *)loginBtn{
    if (!_loginBtn) {
        self.loginBtn = [UIButton buttonWithType:UIButtonTypeSystem];
        [_loginBtn setTitle:@"登录/注册" forState:UIControlStateNormal];
        _loginBtn.titleLabel.font = SYSTEMFONT(22);
        [_loginBtn setTintColor:[UIColor whiteColor]];
    }
    return _loginBtn;
}
@end
